﻿#include "pcrState.h"

ChannelName::ChannelName(QString a) : QString(a){}
ChannelName::ChannelName(const char *unicode) : QString(unicode){}
bool ChannelName::operator>(ChannelName & a){
    if(a == (*this)){
        return false;
    }
    if(a == "FAM"){
        return false;
    }else if(a == "VIC" && (*this) != "FAM"){
        return false;
    }else if(a == "ROX" && (*this) != "FAM" && (*this) != "VIC"){
        return false;
    }
    return true;
}
bool ChannelName::operator<(ChannelName & a){
    if(a == (*this)){
        return false;
    }
    return ! (*this > a);
}

PosiName::PosiName(QString a) : QString(a){}
PosiName::PosiName(const char *unicode) : QString(unicode){}
bool PosiName::operator>(PosiName & a){
    if((*this)[0] != a[0]){
        return QString(*this) > QString(a);
    }else{
        int numThis = this->mid(1).toInt();
        int numA = a.mid(1).toInt();
        return numThis > numA;
    }
}
bool PosiName::operator<(PosiName&a){
    if(a == (*this)){
        return false;
    }
    return !(*this > a);
}

CurveName::CurveName(QString a) : QString(a){}
CurveName::CurveName(QString a, QString b) : QString(a+'_'+b){}
CurveName::CurveName(const char *unicode) : QString(unicode){}

PosiName CurveName::posi() const{
    return (*this).mid(4);
}
ChannelName CurveName::channel() const{
    return (*this).mid(0, 3);
}

bool CurveName::operator>(CurveName &a){
    if(this->posi() != a.posi()){
        return this->posi() > a.posi();
    }
    return this->channel() > a.channel();
}

bool CurveName::operator<(CurveName &a){
    if(a == (*this)){
        return false;
    }
    return !(*this > a);
}

PCRState::PCRState()
{

}

PCRState::~PCRState(){

    // 释放计算模型
    for(auto iter = modelList.begin(); iter != modelList.end(); iter ++){
        if(iter.value() != nullptr){
            delete iter.value();
        }
    }
}


void PCRState::emitGuideRecalculate(){
    emit sigGuideReCalculate();
}

void PCRState::emitThrChanged(){
    calCt();
    calStandardCurve();
    emit sigStandardChanged();
    emit sigThrChanged();
}
void PCRState::emitFilterChanged(){
    boldResult.clear();
    emit sigFilterChanged();
}
void PCRState::emitPageChanged(){
    boldResult.clear();
    calCt();
    calStandardCurve();
    emit sigPageChanged();
}
void PCRState::emitBoldResultChanged(){
    emit sigBoldResultChanged();
}
void PCRState::emitFilterResultChanged(){
    emit sigFilterResultChanged();
}

void PCRState::emitModelChanged(){
    emit sigModelChanged();
}

void PCRState::emitFilterStart(){
    emit sigFilterStart();
}

void PCRState::emitStandardChanged(){
    emit sigStandardChanged();
}

void PCRState::emitGuideNumChanged(){
    qDebug() << "pState发送率guideChanged";
    emit sigGuideNumChanged();
}

void PCRState::emitGuidePageChanged(){
    emit sigGuidePageChanged();
}

void PCRState::emitColorChanged(){
    emit sigColorChanged();
}
